package com.ruoyi.web.controller.system;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.Tixian;
import com.ruoyi.system.service.ITixianService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 提现管理Controller
 * 
 * @author ruoyi
 * @date 2024-08-14
 */
@RestController
@RequestMapping("/caiwu/tixian")
public class TixianController extends BaseController
{
    @Autowired
    private ITixianService tixianService;

    /**
     * 查询提现管理列表
     */
    @PreAuthorize("@ss.hasPermi('caiwu:tixian:list')")
    @GetMapping("/list")
    public TableDataInfo list(Tixian tixian)
    {
        startPage();
        List<Tixian> list = tixianService.selectTixianList(tixian);
        return getDataTable(list);
    }

    /**
     * 导出提现管理列表
     */
    @PreAuthorize("@ss.hasPermi('caiwu:tixian:export')")
    @Log(title = "提现管理", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, Tixian tixian)
    {
        List<Tixian> list = tixianService.selectTixianList(tixian);
        ExcelUtil<Tixian> util = new ExcelUtil<Tixian>(Tixian.class);
        util.exportExcel(response, list, "提现管理数据");
    }

    /**
     * 获取提现管理详细信息
     */
    @PreAuthorize("@ss.hasPermi('caiwu:tixian:query')")
    @GetMapping(value = "/{txId}")
    public AjaxResult getInfo(@PathVariable("txId") String txId)
    {
        return success(tixianService.selectTixianByTxId(txId));
    }

    /**
     * 新增提现管理
     */
    @PreAuthorize("@ss.hasPermi('caiwu:tixian:add')")
    @Log(title = "提现管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Tixian tixian)
    {
        return toAjax(tixianService.insertTixian(tixian));
    }

    /**
     * 修改提现管理
     */
    @PreAuthorize("@ss.hasPermi('caiwu:tixian:edit')")
    @Log(title = "提现管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Tixian tixian)
    {
        return toAjax(tixianService.updateTixian(tixian));
    }

    /**
     * 删除提现管理
     */
    @PreAuthorize("@ss.hasPermi('caiwu:tixian:remove')")
    @Log(title = "提现管理", businessType = BusinessType.DELETE)
	@DeleteMapping("/{txIds}")
    public AjaxResult remove(@PathVariable String[] txIds)
    {
        return toAjax(tixianService.deleteTixianByTxIds(txIds));
    }
}
